package com.deneme;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import functions.images.CommonHTML;
import functions.images.CommonHTML.PageName;

public class Error extends HttpServlet {
	
	public void doPost(HttpServletRequest req,
			HttpServletResponse resp)
					throws IOException {
		
		// Get the error message to display
		String error = (String) req.getAttribute("errormsg");
		
		// Print the html for the error page, as well as displaying the error in that html
		String html = 	"<html>\n" +
			  	"	<head>\n" +
				"		<link rel=\"stylesheet\" href=\"/styles.css\" type=\"text/css\" />\n" +
			  	"		<title>Generic Error Page Title #304</title>\n" +
			  	"	</head>\n" +
			  	"	<body>\n" +
			  	"		<div class='content'>" +
			  	CommonHTML.getNavBar(PageName.none) +
			  	"		<div class='error'>" + error + "</div>\n" +
			  			"</div>" +
			  	"	</body>\n" +
			  	"</html>\n";
		
		resp.setContentType("text/html");
		PrintWriter out = resp.getWriter();
		
		out.print(html);
		
	}
	
}
